package com.kexilo.core.role.domain;

import java.util.ArrayList;
import java.util.List;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import com.kexilo.core.common.core.domain.TreeEntity;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

/**
 * 鑿滃崟鏉冮檺琛?kx_sys_menu
 * 
 * @author Kexilo
 */
@TableName("kx_sys_menu")
public class SysMenu extends TreeEntity<SysMenu> {
    
    private static final long serialVersionUID = 1L;

    /** 鑿滃崟ID */
    @TableId(type = IdType.AUTO)
    private Long menuId;

    /** 鑿滃崟鍚嶇О */
    @NotBlank(message = "鑿滃崟鍚嶇О涓嶈兘涓虹┖")
    @Size(max = 50, message = "鑿滃崟鍚嶇О闀垮害涓嶈兘瓒呰繃50涓瓧绗?")
    private String menuName;

    /** 鐖惰彍鍗曞悕绉?*/
    @TableField(exist = false)
    private String parentName;

    /** 鐖惰彍鍗旾D */
    private Long parentId;

    /** 鏄剧ず椤哄簭 */
    @NotNull(message = "鏄剧ず椤哄簭涓嶈兘涓虹┖")
    private Integer orderNum;

    /** 璺敱鍦板潃 */
    @Size(max = 200, message = "璺敱鍦板潃涓嶈兘瓒呰繃200涓瓧绗?")
    private String path;

    /** 缁勪欢璺緞 */
    @Size(max = 200, message = "缁勪欢璺緞涓嶈兘瓒呰繃255涓瓧绗?")
    private String component;

    /** 璺敱鍙傛暟 */
    private String query;

    /** 鏄惁涓哄閾撅紙0鏄?1鍚︼級 */
    private String isFrame;

    /** 鏄惁缂撳瓨锛?缂撳瓨 1涓嶇紦瀛橈級 */
    private String isCache;

    /** 鑿滃崟绫诲瀷锛圡鐩綍 C鑿滃崟 F鎸夐挳锛?*/
    @NotBlank(message = "鑿滃崟绫诲瀷涓嶈兘涓虹┖")
    private String menuType;

    /** 鑿滃崟鐘舵€侊紙0鏄剧ず 1闅愯棌锛?*/
    private String visible;

    /** 鏉冮檺鏍囪瘑 */
    @Size(max = 100, message = "鏉冮檺鏍囪瘑闀垮害涓嶈兘瓒呰繃100涓瓧绗?")
    private String perms;

    /** 鑿滃崟鍥炬爣 */
    private String icon;

    /** 瀛愯彍鍗?*/
    @TableField(exist = false)
    private List<SysMenu> children = new ArrayList<SysMenu>();

    public SysMenu() {
        
    }

    public SysMenu(Long menuId) {
        this.menuId = menuId;
    }

    // Getter methods
    public Long getMenuId() {
        return menuId;
    }

    public String getMenuName() {
        return menuName;
    }

    public String getParentName() {
        return parentName;
    }

    public Long getParentId() {
        return parentId;
    }

    public Integer getOrderNum() {
        return orderNum;
    }

    public String getPath() {
        return path;
    }

    public String getComponent() {
        return component;
    }

    public String getQuery() {
        return query;
    }

    public String getIsFrame() {
        return isFrame;
    }

    public String getIsCache() {
        return isCache;
    }

    public String getMenuType() {
        return menuType;
    }

    public String getVisible() {
        return visible;
    }

    public String getPerms() {
        return perms;
    }

    public String getIcon() {
        return icon;
    }

    public List<SysMenu> getChildren() {
        return children;
    }

    // Setter methods
    public void setMenuId(Long menuId) {
        this.menuId = menuId;
    }

    public void setMenuName(String menuName) {
        this.menuName = menuName;
    }

    public void setParentName(String parentName) {
        this.parentName = parentName;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public void setOrderNum(Integer orderNum) {
        this.orderNum = orderNum;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public void setComponent(String component) {
        this.component = component;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    public void setIsFrame(String isFrame) {
        this.isFrame = isFrame;
    }

    public void setIsCache(String isCache) {
        this.isCache = isCache;
    }

    public void setMenuType(String menuType) {
        this.menuType = menuType;
    }

    public void setVisible(String visible) {
        this.visible = visible;
    }

    public void setPerms(String perms) {
        this.perms = perms;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public void setChildren(List<SysMenu> children) {
        this.children = children;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;

        SysMenu sysMenu = (SysMenu) o;

        return menuId != null ? menuId.equals(sysMenu.menuId) : sysMenu.menuId == null;
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + (menuId != null ? menuId.hashCode() : 0);
        return result;
    }
}
